<link rel="stylesheet" href="/quickJs/scripts/mui/css/mui.min.css">
<script type="text/javascript" src="/quickJs/scripts/mui/js/mui.min.js"></script>
<link rel="stylesheet" href="/quickJs/scripts/mui/mui.picker.min.css">
<script type="text/javascript" src="/quickJs/scripts/mui/mui.picker.min.js"></script>
<link rel="stylesheet" href="/static/css/measurement/ruler.css">
<link rel="stylesheet" type="text/css" href="/static/css/measurement/selfTest.css" />
<script type="text/javascript" src="/static/lib/util.js"></script>
<script type="text/javascript" src="/static/js/measurement/ruler.js"></script>
<script type="text/javascript">

    //        var data2={refreshUrl:"/html/healthapp/measurement/selfTest_mobile.html",pageUrl:"/html/healthapp/measurement/selfTest_mobile.html"}
    //        $.QuickUrlUtils.refreshJSBridge(data2);
    //
    //        var data = {url: "/html/healthapp/measurement/records_mobile.html?index=1", animate:"push",title: "近期测量",type : "records_mobile"};
    //        $.QuickUrlUtils.redirectJSBridge(data);

    /*初始化时间选择器*/
    var picker = new mui.DtPicker({
        type: "datetime"
    });
    /*保存体征数据服务*/
    var uri_service_tzcl_save = '/api/gzd/tzcl/save';
    /*详细记录页面*/
    var url_tzcl_record = '/html/healthapp/measurement/records_mobile.html';

    /*时间选择器点击回调*/
    function changeTime(){
        /*弹出时间选择器 并传递关闭回调函数*/
        picker.show(function (selectItems) {
            $('#testTime').text(selectItems.y.text+'-'+selectItems.m.text+'-'+selectItems.d.text+' '+selectItems.h.text+':'+selectItems.i.text+":00");
        })
    }

    /*初始化标尺*/
    function initRule(boxid, rule, ratio){
        var box = $("#"+boxid);
        var id_value = box.find(".value").find("span").attr("id");
        /*标尺快处理*/
        box.find('.minus a').on("click", function(){
            minus.apply(this, [id_value, rule, ratio]);
        }).on('touchstart',function(e){
            $(this).find('img').attr('src','/static/images/measurement/selfTest/minus_down.png');
        }).on('touchend',function(e){
            $(this).find('img').attr('src','/static/images/measurement/selfTest/minus.png');
        });

        box.find('.plus').on("click", function(){
            plus.apply(this, [id_value, rule, ratio]);
        }).on('touchstart',function(e){
            $(this).find('img').attr('src','/static/images/measurement/selfTest/add_down.png');
        }).on('touchend',function(e){
            $(this).find('img').attr('src','/static/images/measurement/selfTest/add.png');
        });
    }

    // 码尺加法
    function plus(id, rule, ratio){
        var value_curr = parseFloat($("#" + id).text());
        var num = 1*ratio;
        rule.setValue(value_curr+num);
    }

    // 码尺减法
    function minus(id, rule, ratio){
        var value_curr = parseFloat($("#" + id).text());
        var num = 1*ratio;
        rule.setValue(value_curr-num);
    }
</script>